<?php
namespace Home\Controller;
use Think\Controller;
class ArticleController extends Controller {


	
    public function index(){
	//print_r($_SESSION);exit;
		header('Content-Type:text/html;charset=utf-8');
	
		$pageno = I('p',1);
        $this->assign('pageno',$pageno);// 赋值数据集
		$pageCount = 4;
		$list = M('article')->where($where)->order('id desc')->page($pageno.','.$pageCount)->select();
		foreach( $list as $key => $item){
		
		$list[$key]['author_name'] = M('administrator')->where('id="'.$item['author'].'"')->getField('username');
		
		}
                $dataInfo = M('seotext')->where('col = 6')->find();
	        $this->assign('list',$list);
		$count = M('article')->where($where)->count();
		$this->assign('count',$count);
		$Page = new \Think\Page($count,$pageCount);
		$show = $Page->showAdmin();
		$this->assign('page',$show);
                $this->assign('statusArr',$this->statusArr);
		$this->assign('active7','active');
                $this->assign('title',$dataInfo['title']);
	        $this->assign('keywords',$dataInfo['keywords']);
                $this->assign('description',$dataInfo['description']);
		$this->display('Article/index');
    }
	

	 
  public  function detail(){
 
	  $nowid = I('id');
	  $dataInfo = M('article')->where('id="'.$nowid.'"')->find($id);
	  $dataContent = M('article')->where('id="'.$nowid.'"')->getField('content');
	  $dataInfo['content'] = html_entity_decode($dataContent);
	
	
	$preid = M('article')->where("id<".$nowid)->order('id desc')->limit(1)->getField('id'); 
	
		    if(empty($preid)){
			 $this->assign('msg',100);  
			 }
			 
	$nxtid = M('article')->where("id>".$nowid)->order('id asc')->limit(1)->getField('id');
		
		 if(empty($nxtid)){
			 $this->assign('msg',101); 
			 }
			 
			 
	  if( $dataInfo ){
		 $this->assign('dataInfo', $dataInfo);
		 $this->assign('preid',$preid);  
		 $this->assign('nxtid',$nxtid); 
		 $this->display();
	  }

	}
	


		  
		  
      
	 

	 
}